%-- preliminary settings for listings --%
\lstset{
	captionpos=b,
	commentstyle=\itshape,
	identifierstyle=\ttfamily,
	basicstyle=\normalsize
	}
\renewcommand\lstlistingname{Code fragment}


%-- definition of 3APL --%
\lstdefinelanguage{3APL}
{sensitive=false,
 keywords={	not, and, or, program, send, sent, receive, received, while, do, if,
						then, else, capabilities, beliefbase, goalbase, planbase, pg-rules,
						pr-rules },
 otherkeywords={ :-, ->, | }
}


%-- definition of 2APL --%
\lstdefinelanguage{2APL}
{sensitive=false,
 keywords={ include, beliefupdates, beliefs, goals, plans, pg-rules, pc-rules,
 pr-rules, skip, send, java, adopta, adoptz, dropGoal, dropSubgoal,
 dropExactgoal, if, then, else, while, do, and, or, not, true, event, message },
 otherkeywords={ :-, ->, |,[, ] }
}


%-- definition of Jason --%
\lstdefinelanguage{Jason}
{sensitive=false,
 keywords={	not, and, or},
 otherkeywords={ :-, ->, | }
}


%-- commands for displaying code inline --%
\newcommand{\iapapl}[1]{\lstinline[language=2APL]!#1!}


%-- commands for displaying code from file --%

\newcommand{\apapl}[3]{ % filename, label, caption
  \begin{figure}[ht]
    \lstinputlisting[caption=#3,label=#2,language=2APL]{#1}
	\end{figure}	
}

